
var initGoodsClassifyInfoBean;
var getGoodsClassifyInfoBeanFromOpenPage = function(){
	var goodsclassifyinfoBean = {};
	goodsclassifyinfoBean.id = jQuery('#idEditor').val();
	
	
	goodsclassifyinfoBean.name = jQuery('#nameEditor').val();
	
	if(!goodsclassifyinfoBean.name){
		$.ligerDialog.error("请输入分类名!");
		return null;
	}	goodsclassifyinfoBean.pid = jQuery('#pidEditor').val();
	
	if(!goodsclassifyinfoBean.pid){
		$.ligerDialog.error("请输入父分类!");
		return null;
	}	goodsclassifyinfoBean.type = jQuery('#typeEditor').val();
	
	if(!goodsclassifyinfoBean.type){
		$.ligerDialog.error("请输入商品类型!");
		return null;
	}	
	return goodsclassifyinfoBean;
};

var initGoodsClassifyInfoPage = function(){
	jQuery('#ligerType').ligerComboBox({
		data:goodsTypeRenderData,
		valueField:'value',
		textField:'text',
		valueFieldID:'typeEditor'
	});
};

var bindGoodsClassifyInfoUpdateButtom = function(){
	jQuery('#updateEdit').unbind('click').click(function(){
		var goodsclassifyinfoBean = getGoodsClassifyInfoBeanFromOpenPage();
		if(null != goodsclassifyinfoBean){
			doSaveGoodsClassifyInfos([goodsclassifyinfoBean]);
		}
	});
};
var bindGoodsClassifyInfoResetButtom = function(){
	jQuery('#resetEdit').unbind('click').click(function(){
		if(!initGoodsClassifyInfoBean){
			jQuery("#nameEditor").val('');
			jQuery("#pidEditor").val('');
			jQuery("#typeEditor").val('');
		}else{
			if(!initGoodsClassifyInfoBean.name){
				jQuery("#nameEditor").val('');
			}else{
				jQuery("#nameEditor").val(initGoodsClassifyInfoBean.name);
			}
			if(!initGoodsClassifyInfoBean.pid){
				jQuery("#pidEditor").val('');
			}else{
				jQuery("#pidEditor").val(initGoodsClassifyInfoBean.pid);
			}
			if(!initGoodsClassifyInfoBean.type){
				jQuery("#typeEditor").val('');
			}else{
				jQuery("#typeEditor").val(initGoodsClassifyInfoBean.type);
			}
		}
	});
};



jQuery(function(){
	initGoodsClassifyInfoPage();
	bindGoodsClassifyInfoUpdateButtom();
	bindGoodsClassifyInfoResetButtom();
});